<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import { getNoticeStatus } from "@/services/api";
import { Toast } from "vant";
export default {
  name: "app",
  created() {
    if (window.timer) {
      clearInterval(window.timer);
    }
  },
};

window.getNoticeStatus = () => {
  window.timer = setInterval(() => {
    getNoticeStatus().then((res) => {
      if (res) {
        if (res.hasCompleteDelivery || res.hasNoDelivery) {
          try {
            window.appPlat.openAlarmAndVibrate();
          } catch (e) {
            Toast("设置未成功");
          }
        }
      }
    });
  }, 30000);
};
</script>

<style lang="scss">
* {
  margin: 0;
  padding: 0;
}
body {
  background-color: #f5f5f5;
}
[v-cloak] {
  display: none;
}
</style>
